//
//  ViewController.m
//  Catalogue
//
//  Created by student on 16/2/22.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"
#import "OneViewController.h"
#import "TwoViewController.h"
#import "ThreeViewController.h"

@interface ViewController ()

@property (nonatomic,strong) OneViewController *oneVC;
@property (nonatomic,strong) TwoViewController *twoVC;
@property (nonatomic,strong) ThreeViewController *threeVC;

@end

@implementation ViewController

- (OneViewController *)oneVC
{
    if (!_oneVC)
    {
        _oneVC = [[OneViewController alloc] init];
    }
    return _oneVC;
}

- (TwoViewController *)twoVC
{
    if (!_twoVC)
    {
        _twoVC = [[TwoViewController alloc] init];
    }
    return _twoVC;
}

- (ThreeViewController *)threeVC
{
    if (!_threeVC)
    {
        _threeVC = [[ThreeViewController alloc] init];
    }
    return _threeVC;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (IBAction)Fristbtnpressed:(id)sender
{
    [UIView beginAnimations:@"ViewFlip" context:nil];
    [UIView setAnimationDuration:1.25];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [self.view insertSubview:self.oneVC.view atIndex:0];
    [self.twoVC.view removeFromSuperview];
    [self.threeVC.view removeFromSuperview];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
    [UIView commitAnimations];

}
- (IBAction)Secondbtnpressed:(id)sender
{
    [UIView beginAnimations:@"ViewFlip" context:nil];
    [UIView setAnimationDuration:1.25];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [self.view insertSubview:self.twoVC.view atIndex:0];
    [self.oneVC.view removeFromSuperview];
    [self.threeVC.view removeFromSuperview];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
    [UIView commitAnimations];
}
- (IBAction)Thirldbtnpressed:(id)sender
{
    [UIView beginAnimations:@"ViewFlip" context:nil];
    [UIView setAnimationDuration:1.25];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [self.view insertSubview:self.threeVC.view atIndex:0];
    [self.twoVC.view removeFromSuperview];
    [self.oneVC.view removeFromSuperview];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
    [UIView commitAnimations];

}

@end
